import { CSSProperties } from "vue";
import { RuleItem } from "./rules";

export interface FormOptionsVO {
  type:
    | "autocomplete"
    | "cascader"
    | "checkbox"
    | "checkbox-group"
    | "checkbox-button"
    | "color-picker"
    | "date-picker"
    | "input"
    | "input-number"
    | "radio"
    | "radio-group"
    | "radio-button"
    | "rate"
    | "select"
    | "option"
    | "slider"
    | "switch"
    | "time-picker"
    | "time-select"
    | "transfer"
    | "upload"
    | "editor";
  //单一表单值 upload组件不一定有value
  value?: any;
  //单一表单label
  label?: string;
  // model 的键名 ,使用validate时必填
  prop?: string;
  // 表单项的验证规则
  rules?: RuleItem[];
  //是否必填项
  required?: boolean;
  // 占位符
  placeholder?: string;
  //表单元素特有属性
  attrs?: {
    clearable?: boolean;
    showPassword?: boolean;
    disabled?: boolean;
    style?: CSSProperties;
  };
  //表单组合子元素  如： el-select的options
  children?: FormOptionsVO[];
  //上传组件的属性和方法
  uploadAttrs?: {
    action: string;
    headers?: object;
    multiple?: boolean;
    method?: string;
    data?: any;
    name?: string;
    withCredentials?: boolean;
    showFileList?: boolean;
    drag?: boolean;
    accept?: string;
    autoUpload?: boolean;
    listType?: "text" | "picture" | "picture-card";
    disabled?: boolean;
    limit?: number;
  };
  editorConfig?: {
    placeholder?: string;
  };
}
